import { checkDataOk } from "../response";

export class UserController {
  constructor(opt) {
    this.proxyController = opt.proxyController;
    this.conf = opt.conf;
  }

  async getUserInfo(c){
    const res = await this.proxyController.request(c.req, '/work_ai/user/info')

    const response = await res.json()

    if(! checkDataOk(response)){
      return c.json(response)
    }

    const { user } = response.data

    this.conf.set('ai_user_token', user.user_token)

    return c.json(response)
  }
}